package us.mooresr.webtroopmanager.client.place;

import com.google.gwt.place.shared.Place;
import com.google.gwt.place.shared.PlaceTokenizer;

public class EventDriversPlace extends Place {
	private Long eventId;

	public EventDriversPlace(Long eventId) {
		super();
		this.eventId = eventId;
	}

	public Long getEventId() {
		return eventId;
	}
	
	public static class Tokenizer implements PlaceTokenizer<EventDriversPlace> {

		@Override
		public EventDriversPlace getPlace(String token) {
			Long eventId;
			
			if ((token == null) || token.equals("null")) {
				eventId = null;
			} else {
				eventId = Long.parseLong(token);
			}
			return new EventDriversPlace(eventId);
		}

		@Override
		public String getToken(EventDriversPlace place) {
			Long eventId = place.getEventId();
			
			if (eventId == null) {
				return "null";
			} else {
				return eventId.toString();
			}
		}
	}

}
